package individual.ircon.bilibili.ui;

import javafx.application.Application;
import javafx.application.Platform;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Tab;
import javafx.scene.control.TabPane;
import javafx.stage.Stage;

import java.io.IOException;

public class UIApp extends Application {
    @Override
    public void start(Stage primaryStage) throws Exception {
//        Platform.setImplicitExit(true);


        Scene scene = new Scene(getMainPanel());
        primaryStage.setScene(scene);
        primaryStage.setHeight(700);
        primaryStage.setWidth(700);
        primaryStage.setTitle("Bilibili抽奖工具");
        primaryStage.show();

    }

    private Parent getMainPanel() throws IOException {
        DanmuLotteryCmd cmd = new DanmuLotteryCmd();
        var com = CommentLottery.getLoader();

        TabPane pane = new TabPane();
        pane.setTabClosingPolicy(TabPane.TabClosingPolicy.UNAVAILABLE);
        Tab tab1 = new Tab("弹幕抽奖", cmd.getUI());
        Tab tab2 = new Tab("评论区抽奖", com.load());
        pane.getTabs().addAll(tab1, tab2);
        return pane;
    }
}
